﻿//using Microsoft.AspNetCore.Mvc.Razor;
//using Microsoft.AspNetCore.Razor.Language;
//using Microsoft.Extensions.Logging;
//using Microsoft.Extensions.Options;
//using System;
//using System.Diagnostics;
//using System.Text.Encodings.Web;

//namespace SingleBlog.Framework.UI
//{
//    using Microsoft.AspNetCore.Mvc.RazorPages;
//    using Microsoft.Extensions.DependencyInjection;

//    internal class SingleBlogViewEngine : RazorViewEngine
//    {
//        public SingleBlogViewEngine(
//            IServiceScopeFactory serviceScope,
//            IRazorPageFactoryProvider pageFactory, 
//            IRazorPageActivator pageActivator, 
//            HtmlEncoder htmlEncoder, 
//            IOptions<RazorViewEngineOptions> optionsAccessor, 
//            IOptions<RazorPagesOptions> optionsRazorPageAccessor,
//            RazorProject razorProject, 
//            ILoggerFactory loggerFactory, 
//            DiagnosticSource diagnosticSource) 
//            : base(pageFactory, pageActivator, htmlEncoder, optionsAccessor, razorProject, loggerFactory, diagnosticSource)
//        {
//            try
//            {
                

//                optionsAccessor.Value.AreaViewLocationFormats.Clear();
//                optionsAccessor.Value.AreaViewLocationFormats.Add("/Areas/{2}/Views/{1}/{0}" + ViewExtension);
//                optionsAccessor.Value.AreaViewLocationFormats.Add("/Areas/{2}/Views/Shared/{0}" + ViewExtension);

//                optionsAccessor.Value.ViewLocationFormats.Clear();

//                optionsAccessor.Value.ViewLocationFormats.Add("/Views/{1}/{0}" + RazorViewEngine.ViewExtension);
//                optionsAccessor.Value.ViewLocationFormats.Add("/Views/Shared/{0}" + RazorViewEngine.ViewExtension);

//                optionsAccessor.Value.PageViewLocationFormats.Add($"/Templates/Shared/{{0}}{ViewExtension}");
//                optionsAccessor.Value.PageViewLocationFormats.Add($"{optionsRazorPageAccessor.Value.RootDirectory}/Shared/{{0}}{ViewExtension}");                
//            }
//            catch(InvalidOperationException ex)
//            {
//                loggerFactory.CreateLogger(this.GetType()).LogError(ex, ex.Message);
//            }
//        }

       
//    }
//}
